<extend name="Index/index" />

<block name="mycss">
    
</block>

<block name="main">
    <!-- 主体部分开始 -->
    <div class="container">
        <div class="col-md-10 col-md-offset-1 ">
            <!-- 主体左侧 -->
            <div class="col-md-9">
                <!-- 左上 1 -->
                <div class="row">
                    <div class="col-md-8">
                        <span class="glyphicon glyphicon-th-list"></span>
                        &ensp;<b>话题广场</b>
                    </div>
                    <div class="col-md-4 text-right h6 text-muted">已关注 <{$at_num}> 个话题</div>
                </div>
                <div class="divline"></div>

                <!-- 左上 2 -->
                <div class="row">
                    <div class="col-md-12 mt10" id="topic_label">
                        <!-- for循环遍历0级话题 -->
                        <for start="0" end="33">
                            <a href="<{:U('Topics/index', 'tid='.($i+1))}>" class="radius_label" topicid="<{$i+1}>"><{$arr[$i]}></a>
                        </for>
                    </div>
                </div>
                <div class="divline mt10"></div>

                <!-- 左侧内容正文 遍历话题列表 -->
                <div class="row">
                    <div class="col-md-12" id="topic_l">
                        <!-- 判断是否有数据 -->
                        <empty name="data">
                            <div class="w100 h5 mt10 text-center" style="background-color:#eee; height: 80px; line-height: 80px;">暂无更多相关话题</div>
                        <else/>
                            <volist name="data" id="vo">
                                <div class="col-md-6 mt30 topicshow" style="border-bottom: 1px dashed #ccc;">
                                    <div class="col-md-2 topic_img">
                                        <img src="__PUBLIC__/imgs/<{$vo.image}>" height="45px" width="45px">
                                    </div>
                                    <div class="col-md-10">
                                        <div class="col-md-6">
                                            <b><a href="<{:U('Topics/detail', 'tid='.$vo['id'])}>">
                                                <{$vo.name}>
                                            </a></b>
                                        </div>
                                        <div class="col-md-6 text-right">
                                            <a href="" class="attend_t h6 text-right" topic_id="<{$vo.id}>">关注</a>
                                        </div>
                                        <div class="col-md-12 h6 text-muted">
                                            <{$vo.detail}>
                                        </div>
                                    </div>
                                </div>
                            </volist>
                            <div class="clearfix"></div>
                            <div class="mt30 mb20">
                                <a href="<{:U('Topics/index', array('p'=>$p,'tid'=>$tid))}>" class="btn btn-default btn-sm form-control">查 看 更 多</a>
                            </div>
                        </empty>
                    </div>
                </div>
            </div>

            <!-- 主体右侧 -->
            <div class="col-md-3">
                <div class="h6 rightshow">
                    <a href="<{:U('Index/index')}>"  style="color:#888"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;知乎首页</a>

                    <a href="<{:U('Collections/index')}>"  style="color:#888"><span class="glyphicon glyphicon-bookmark"></span>&nbsp;&nbsp;我的收藏</a>

                    <a href="<{:U('Question/following')}>"  style="color:#888"><span class="glyphicon glyphicon-check"></span>&nbsp;&nbsp;我关注的问题</a>

                    <a href="<{:U('Topics/index')}>" style="color:#888"><span class="glyphicon glyphicon-th-large"></span>&nbsp;&nbsp;话题广场</a>


                </div>

                <h5 class="mt30"> <b><img src="__PUBLIC__/images/2016-07-21_141413.jpg">&nbsp;&nbsp;知乎专栏</b> </h5>
                <div class="h6 rightshow">
                    <a href="<{:U('Explore/index')}>"  style="color:#888">发现</a>
                    <a href="<{:U('Article/index')}>"  style="color:#888">文章</a>
                </div>
                <div >© 2016 知乎</div>

            </div>
        </div><!--  end row  -->
        <!-- 清除浮动 -->
        <div class="clearfix"></div>
    </div>
    <!-- 主体部分结束 -->


</block>

<block name="myjs">
    <script type="text/javascript">
        //话题关注
        var tattend = $('a.attend_t');
            for (var i = 0; i < tattend.length; i++) {
                $(tattend[i]).click(function(){
                    // console.log($(this));
                    var tid = $(this).attr('topic_id');
                    // console.log(uid);
                    // 判断a标签是关注还是否
                    if ($(this).text() == '关注') {
                        $.ajax({
                            type: 'get',
                            url: "<{:U('Attend/attendT')}>",
                            data: 'id=' + tid,
                        });
                        $(this).text('取消关注');
                    } else {
                        $.ajax({
                            type: 'get',
                            url: "<{:U('Attend/notAttendT')}>",
                            data: 'id=' + tid,
                        });
                        $(this).html('关注');
                    };
                    return false; //阻止跳转
                });
            }; // 关注话题点击事件结束
    </script>
</block>